#include "test_data.h"
#include "base.pb.h"
#include "camera.pb.h"
#include "track.pb.h"
#include "system.pb.h"
#include "rgb.pb.h"
#include "track.pb.h"
#include "motor_control.pb.h"
#include "focus.pb.h"
#include "astro.pb.h"
#include "ws_constant.h"
#include "elog.h"
#include "elog_file.h"
#include "notify.pb.h"
#include "notify.h"
#include "panorama.pb.h"

#include <iostream>

void testWsPacket(int cmd, int module_id, int type, std::string& serialized_data) {
    WsPacket ws_packet;
    ws_packet.set_major_version(1);
    ws_packet.set_minor_version(1);
    ws_packet.set_device_id(WS_DEVICE_ID);
    ws_packet.set_cmd(cmd);
    ws_packet.set_module_id(module_id);
    ws_packet.set_type(type);
    ws_packet.set_client_id(WS_TEST_CLIENT_ID_1);

    if (serialized_data.size() > 0)
        ws_packet.set_data(serialized_data);

    size_t packet_size = ws_packet.ByteSizeLong();
    const size_t len = packet_size;
    uint8_t pakcet_buffer[len];
    log_i("pakcet_buffer = %s, size = %d", pakcet_buffer, packet_size);
    ws_packet.SerializeToArray(pakcet_buffer, packet_size);

    for (int i = 0; i < len; i++) {
        printf("%02x ", pakcet_buffer[i]);
    }
    printf("\n");
}

void testWsPacketById(int cmd, int module_id, int type, std::string& serialized_data, const std::string& client_id) {
    WsPacket ws_packet;
    ws_packet.set_major_version(1);
    ws_packet.set_minor_version(1);
    ws_packet.set_device_id(WS_DEVICE_ID);
    ws_packet.set_cmd(cmd);
    ws_packet.set_module_id(module_id);
    ws_packet.set_type(type);
    ws_packet.set_client_id(client_id);

    if (serialized_data.size() > 0)
        ws_packet.set_data(serialized_data);

    size_t packet_size = ws_packet.ByteSizeLong();
    const size_t len = packet_size;
    uint8_t pakcet_buffer[len];
    log_i("pakcet_buffer = %s, size = %d", pakcet_buffer, packet_size);
    ws_packet.SerializeToArray(pakcet_buffer, packet_size);

    for (int i = 0; i < len; i++) {
        printf("%02x ", pakcet_buffer[i]);
    }
    printf("\n");
}

/*
12 08 44 57 41 52 46 20 49 49 18 01 20 90 4e
*/
void testDataOpenCamTele() {
    log_i("testDataOpenCamTele");
    ReqOpenCamera req_open_camera;
    req_open_camera.set_binning(false);
    std::string serialized_data;
    req_open_camera.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_OPEN_CAMERA, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 01 20 91 4e
*/
void testDataCloseCamTele() {
    log_i("testDataCloseCamTele");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_CLOSE_CAMERA, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 01 20 92 4e 32 08 08 84 07 10 f4 03 18 02
*/
void testDataPhoto() {
    log_i("testDataPhoto");
    // ReqPhoto req_photo;
    // req_photo.set_x(960);
    // req_photo.set_y(540);
    // req_photo.set_ratio(1);
    std::string serialized_data;
    // req_photo.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_PHOTOGRAPH, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 93 4e 32 02 10 0a
*/
void testDataBurstPhoto() {
    log_i("testDataBurstPhoto");
    ReqBurstPhoto req_burst_photo;
    req_burst_photo.set_count(10);
    std::string serialized_data;
    req_burst_photo.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_BURST, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 94 4e
*/
void testDataStopBurstPhoto() {
    log_i("testDataStopBurstPhoto");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_STOP_BURST, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 95 4e
*/
void testDataStartRecord() {
    log_i("testDataStartRecord");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_START_RECORD, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 96 4e
*/
void testDataStopRecord() {
    log_i("testDataStopRecord");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_STOP_RECORD, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 97 4e 32 02 08 01
*/
void testDataSetExpMode() {
    log_i("testDataSetExpMode");
    ReqSetExpMode req_set_exp_mode;
    req_set_exp_mode.set_mode(1);
    std::string serialized_data;
    req_set_exp_mode.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_EXP_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 98 4e
*/
void testDataGetExpMode() {
    log_i("testDataGetExpMode");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_EXP_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 01 20 99 4e 32 02 08 03
*/
void testDataSetExp() {
    log_i("testDataSetExp");
    ReqSetExp req_set_exp;
    req_set_exp.set_index(3);
    std::string serialized_data;
     req_set_exp.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_EXP, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

void testDataSetExpById(const std::string& client_id) {
    log_i("testDataSetExpById");
    ReqSetExp req_set_exp;
    req_set_exp.set_index(3);
    std::string serialized_data;
     req_set_exp.SerializeToString(&serialized_data);
    testWsPacketById(CMD_CAMERA_TELE_SET_EXP, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data, client_id);
}

/*
12 08 44 57 41 52 46 20 49 49 18 01 20 9a 4e
*/
void testDataGetExp() {
    log_i("testDataGetExp");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_EXP, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}


/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 9b 4e 32 02 08 01
*/
void testDataSetGainMode() {
    log_i("testDataSetGainMode");
    ReqSetGainMode req_set_gain_mode;
    req_set_gain_mode.set_mode(1);
    std::string serialized_data;
    req_set_gain_mode.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_GAIN_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 9c 4e
*/
void testDataGetGainMode() {
    log_i("testDataGetGainMode");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_GAIN_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 9d 4e 32 02 08 0a
*/
void testDataSetGain() {
    log_i("testDataSetGain");
    ReqSetGain req_set_gain;
    req_set_gain.set_index(3);
    std::string serialized_data;
    req_set_gain.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_GAIN, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 9e 4e
*/
void testDataGetGain() {
    log_i("testDataGetGain");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_GAIN, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 9f 4e 32 02 08 64
*/
void testDataSetBrightness() {
    log_i("testDataSetBrightness");
    ReqSetBrightness req_set_brightness;
    req_set_brightness.set_value(100);
    std::string serialized_data;
    req_set_brightness.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_BRIGHTNESS, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a0 4e
*/
void testDataGetBrightness() {
    log_i("testDataGetBrightness");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_BRIGHTNESS, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a1 4e 32 02 08 64
*/
void testDataSetContrast() {
    log_i("testDataSetContrast");
    ReqSetContrast req_set_contrast;
    req_set_contrast.set_value(100);
    std::string serialized_data;
    req_set_contrast.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_CONTRAST, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a2 4e
*/
void testDataGetContrast() {
    log_i("testDataGetContrast");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_CONTRAST, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a3 4e 32 02 08 64
*/
void testDataSetSaturation() {
    log_i("testDataSetSaturation");
    ReqSetSaturation req_set_saturation;
    req_set_saturation.set_value(100);
    std::string serialized_data;
    req_set_saturation.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_SATURATION, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a4 4e
*/
void testDataGetSaturation() {
    log_i("testDataGetSaturation");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_SATURATION, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a5 4e 32 02 08 64
*/
void testDataSetHue() {
    log_i("testDataSetHue");
    ReqSetHue req_set_hue;
    req_set_hue.set_value(100);
    std::string serialized_data;
    req_set_hue.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_HUE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a6 4e
*/
void testDataGetHue() {
    log_i("testDataGetHue");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_HUE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a7 4e 32 02 08 64
*/
void testDataSetSharpness() {
    log_i("testDataSetSharpness");
    ReqSetSharpness req_set_sharpness;
    req_set_sharpness.set_value(100);
    std::string serialized_data;
    req_set_sharpness.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_SHARPNESS, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a8 4e
*/
void testDataGetSharpness() {
    log_i("testDataGetSharpness");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_SHARPNESS, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 a9 4e 32 02 08 01
*/
void testDataSetWBMode() {
    log_i("testDataSetWBMode");
    ReqSetWBMode req_set_wb_mode;
    req_set_wb_mode.set_mode(3);
    std::string serialized_data;
    req_set_wb_mode.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_WB_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 aa 4e
*/
void testDataGetWBMode() {
    log_i("testDataGetWBMode");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_WB_MODE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 ab 4e 32 02 08 64
*/
void testDataSetWBScene() {
    log_i("testDataSetWBScene");
    ReqSetWBSence req_set_wb_scene;
    req_set_wb_scene.set_value(100);
    std::string serialized_data;
    req_set_wb_scene.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_WB_SCENE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 ac 4e
*/
void testDataGetWBScene() {
    log_i("testDataGetWBScene");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_WB_SCENE, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 ad 4e 32 02 08 64
*/
void testDataSetWBCT() {
    log_i("testDataSetWBCT");
    ReqSetWBCT req_set_wbct;
    req_set_wbct.set_index(3);
    std::string serialized_data;
    req_set_wbct.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_WB_CT, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 ae 4e
*/
void testDataGetWBCT() {
    log_i("testDataGetWBCT");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_WB_CT, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 af 4e
*/
void testDataSetIrCut() {
    log_i("testDataSetIrCut");
    ReqSetIrCut req_set_ircut;
    req_set_ircut.set_value(0);
    std::string serialized_data;
    req_set_ircut.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_TELE_SET_IRCUT, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 01 20 b0 4e
*/
void testDataGetIrCut() {
    log_i("testDataGetIrCut");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_IRCUT, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

void testDataStartTimeLapse() {
    log_i("testDataStartTimeLapse");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_START_TIMELAPSE_PHOTO, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

void testDataStopTimeLapse() {
    log_i("testDataStopTimeLapse");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_STOP_TIMELAPSE_PHOTO, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

void testDataGetAllParams() {
    log_i("testDataGetAllParams");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_TELE_GET_ALL_PARAMS, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*----------------------------------------------------------------广角模块测试数据-----------------------------------------------------------*/
/*
12 08 44 57 41 52 46 20 49 49 18 02 20 e0 5d
*/
void testDataOpenCamWide() {
    log_i("testDataOpenCamWide");
    ReqOpenCamera req_open_camera;
    req_open_camera.set_binning(false);
    std::string serialized_data;
    req_open_camera.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_WIDE_OPEN_CAMERA, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 02 20 e1 5d
*/
void testDataCloseCamWide() {
    log_i("testDataCloseCamWide");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_CLOSE_CAMERA, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 f6 5d
*/
void testDataCamWidePhotograph() {
    log_i("testDataCamWidePhotograph");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_PHOTOGRAPH, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 f7 5d 32 02 08 1e
*/
void testDataCamWideBurst() {
    log_i("testDataCamWideBurst");
    ReqBurstPhoto req_burst_photo;
    req_burst_photo.set_count(30);
    std::string serialized_data;
    req_burst_photo.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_WIDE_BURST, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 f8 5d
*/
void testDataCamWideStopBurst() {
    log_i("testDataCamWideStopBurst");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_STOP_BURST, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 f9 5d
*/
void testDataCamWideStartTimeLapse() {
    log_i("testDataCamWideStartTimeLapse");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_START_TIMELAPSE_PHOTO, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 fa 5d
*/
void testDataCamWideStopTimeLapse() {
    log_i("testDataCamWideStopTimeLapse");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_STOP_TIMELAPSE_PHOTO, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 e2 5d 32 02 08 01
*/
void testDataCamWideSetExpMode() {
    log_i("testDataCamWideSetExpMode");
    ReqSetExpMode req_set_exp_mode;
    req_set_exp_mode.set_mode(1);
    std::string serialized_data;
    req_set_exp_mode.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_WIDE_SET_EXP_MODE, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 02 20 e3 5d
*/
void testDataCamWideGetExpMode() {
    log_i("testDataCamWideGetExpMode");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_GET_EXP_MODE, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

/*
08 01 10 01 18 01 20 02 28 99 4e 3a 02 08 03 42 09 74 65 73 74 5f 69 64 5f 31
*/
void testDataCamWideSetExp() {
    log_i("testDataCamWideSetExp");
    ReqSetExp req_set_exp;
    req_set_exp.set_index(3);
    std::string serialized_data;
     req_set_exp.SerializeToString(&serialized_data);
    testWsPacket(CMD_CAMERA_WIDE_SET_EXP, MODULE_CAMERA_WIDE, CMD_TYPE_REQUEST, serialized_data);
}

void testDataCamWideGetExp() {
    log_i("testDataCamWideGetExp");
    std::string serialized_data;
    testWsPacket(CMD_CAMERA_WIDE_GET_EXP, MODULE_CAMERA_TELE, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 04 20 c8 65 32 06 08 ca e4 d6 a3 06
*/
void testDataSystemSetTime() {
    log_i("testDataSystemSetTime");
    ReqSetTime req_set_time;
    req_set_time.set_timestamp(1685434954);
    std::string serialized_data;
    req_set_time.SerializeToString(&serialized_data);
    testWsPacket(CMD_SYSTEM_SET_TIME, MODULE_SYSTEM, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 04 20 c9 65 32 15 0a 13 41 6d 65 72 69 63 61 2f 4c 6f 73 5f 41 6e 67 65 6c 65 73
*/
void testDataSystemSetTimezone() {
    log_i("testDataSystemSetTimezone");
    ReqSetTimezone req_set_timezone;
    req_set_timezone.set_timezone("America/Los_Angeles");
    std::string serialized_data;
    req_set_timezone.SerializeToString(&serialized_data);
    testWsPacket(CMD_SYSTEM_SET_TIME_ZONE, MODULE_SYSTEM, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b0 6d 32 12 08 01 11 00 00 00 00 00 00 34 40 18 01 20 e8 07 28 05
*/
void testDataMotorRun() {
    log_i("testDataMotor 1 Run");
    ReqMotorRun req_motor_run;
    req_motor_run.set_id(1);
    req_motor_run.set_speed(20);
    req_motor_run.set_direction(1);
    req_motor_run.set_speed_ramping(1000);
    req_motor_run.set_resolution_level(5);
    std::string serialized_data;
    req_motor_run.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_RUN, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b2 6d 32 02 08 01
*/
void testDataMotorStop() {
    log_i("testDataMotor 1 Stop");
    ReqMotorStop req_motor_stop;
    req_motor_stop.set_id(1);
    std::string serialized_data;
    req_motor_stop.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_STOP, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b4 6d 32 0b 08 01 11 00 00 00 00 00 00 3e 40
*/
void testDataMotorChangeSpeed() {
    log_i("testDataMotor 1 Change speed 30");
    ReqMotorChangeSpeed req_motor_change_speed;
    req_motor_change_speed.set_id(1);
    req_motor_change_speed.set_speed(30);
    std::string serialized_data;
    req_motor_change_speed.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_CHANGE_SPEED, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b5 6d 32 02 08 01
*/
void testDataMotorChangeDirection() {
    log_i("testDataMotor 1 Change direction 0");
    ReqMotorChangeDirection req_motor_change_direction;
    req_motor_change_direction.set_id(1);
    req_motor_change_direction.set_direction(0);
    std::string serialized_data;
    req_motor_change_direction.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_CHANGE_DIRECTION, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b1 6d 32 19 08 02 11 00 00 00 00 00 80 66 40 19 00 00 00 00 00 00 3e 40 20 e8 07 28 05
*/
void testDataMotorRunTo() {
    log_i("testDataMotor 2 Run to");
    ReqMotorRunTo req_motor_run_to;
    req_motor_run_to.set_id(2);
    req_motor_run_to.set_end_position(180);
    req_motor_run_to.set_speed(30);
    req_motor_run_to.set_speed_ramping(1000);
    req_motor_run_to.set_resolution_level(5);
    std::string serialized_data;
    req_motor_run_to.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_RUN_TO, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b3 6d 32 02 08 02
*/
void testDataMotorReset() {
    log_i("testDataMotor 2 Reset");
    ReqMotorReset req_motor_reset;
    req_motor_reset.set_id(2);
    req_motor_reset.set_direction(0);
    std::string serialized_data;
    req_motor_reset.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_RESET, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b6 6d 32 1b 09 00 00 00 00 00 80 46 40 11 00 00 00 00 00 00 e0 3f 19 00 00 00 00 00 00 3e 40
*/
void testDataMotorServiceJoystick() {
    log_i("testDataMotorServiceJoystick");
    ReqMotorServiceJoystick req_motor_service_joystick;
    req_motor_service_joystick.set_vector_angle(45);
    req_motor_service_joystick.set_vector_length(0.5);
    req_motor_service_joystick.set_speed(30);
    std::string serialized_data;
    req_motor_service_joystick.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_SERVICE_JOYSTICK, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b7 6d 32 1b 09 00 00 00 00 00 80 46 40 11 00 00 00 00 00 00 e0 3f 19 00 00 00 00 00 00 3e 40
*/
void testDataServiceJoystickFixedAngle() {
    log_i("testDataServiceJoystickFixedAngle");
    ReqMotorServiceJoystick req_motor_service_joystick;
    req_motor_service_joystick.set_vector_angle(45);
    req_motor_service_joystick.set_vector_length(0.5);
    req_motor_service_joystick.set_speed(30);
    std::string serialized_data;
    req_motor_service_joystick.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_SERVICE_JOYSTICK_FIXED_ANGLE, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 06 20 b8 6d
*/
void testDataServiceJoystickStop() {
    log_i("testDataServiceJoystickStop");
    std::string serialized_data;
    testWsPacket(CMD_STEP_MOTOR_SERVICE_JOYSTICK_STOP, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

void testDataDualCameraLinkage() {
    log_i("testDataDualCameraLinkage");
    ReqDualCameraLinkage req_dual_camera_linkage;

    req_dual_camera_linkage.set_x(545);
    req_dual_camera_linkage.set_y(933);

    std::string serialized_data;
    req_dual_camera_linkage.SerializeToString(&serialized_data);
    testWsPacket(CMD_STEP_MOTOR_SERVICE_DUAL_CAMERA_LINKAGE, MODULE_MOTOR, CMD_TYPE_REQUEST, serialized_data);
}

/*---------------------------------------------跟踪功能-----------------------------------------------*/
/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 06 20 d0 73 32 0c 08 84 07 10 f4 03 18 90 03 20 c8 01
*/
void testDataStartTrack() {
    log_i("testDataStartTrack");
    ReqStartTrack req_start_track;
    req_start_track.set_x(900);
    req_start_track.set_y(500);
    req_start_track.set_w(400);
    req_start_track.set_h(200);
    std::string serialized_data;
    req_start_track.SerializeToString(&serialized_data);
    testWsPacket(CMD_TRACK_START_TRACK, MODULE_TRACK, CMD_TYPE_REQUEST, serialized_data);
}

/*

*/
void testDataStopTrack() {
    log_i("testDataStopTrack");
    std::string serialized_data;
    testWsPacket(CMD_TRACK_STOP_TRACK, MODULE_TRACK, CMD_TYPE_REQUEST, serialized_data);
}


/*-----------------------------------------------对焦模块----------------------------------------------*/
/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 08 20 98 75
*/
void testDataAutoFocus() {
    log_i("testDataAutoFocus");
    std::string serialized_data;
    testWsPacket(CMD_FOCUS_AUTO_FOCUS, MODULE_FOCUS, CMD_TYPE_REQUEST, serialized_data);
}

/*-----------------------------------------------天文模块----------------------------------------------*/
/*

*/
void testOneClickGoto() {
    log_i("testOneClickGoto");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_START_ONE_CLICK_GOTO, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 03 20 f8 55
*/
void testCalibration() {
    log_i("testCalibration");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_START_CALIBRATION, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*

*/
void testStopCalibration() {
    log_i("testStopCalibration");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_STOP_CALIBRATION, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 03 20 fa 55 32 30 09 eb e5 77 9a cc f0 34 40 11 4f ab 8d 56 5a f3 45 40 1a 1c 4e 47 43 37 30 30 30 20 4e 6f 72 74 68 20 41 6d 65 72 69 63 61 20 4e 65 62 75 6c 61
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 03 20 fa 55 32 17 09 b3 45 d2 6e f4 b1 30 40 11 9a b0 fd 64 8c 3b 42 40 1a 03 4d 31 33
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 03 20 fa 55 32 17 09 71 e4 81 c8 22 cd e6 3f 11 0c 05 6c 07 23 a2 44 40 1a 03 4d 33 31
*/
void testGotoNGC7000() {
    log_i("testGotoNGC7000");
    ReqGotoDSO req_goto_dso;
    req_goto_dso.set_ra(0.712541);
    req_goto_dso.set_dec(41.266694);
    req_goto_dso.set_target_name("M31");
    std::string serialized_data;
    req_goto_dso.SerializeToString(&serialized_data);
    testWsPacket(CMD_ASTRO_START_GOTO_DSO, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 03 20 fb 55 32 1a 08 07 11 05 6d 72 f8 a4 9b 5c 40 19 e1 7a 14 ae 47 81 3e 40 22 04 4d 6f 6f 6e
*/
void testGotoMoon() {
    log_i("testGotoMoon");
    ReqGotoSolarSystem req_goto_solar_system;
    req_goto_solar_system.set_index(7);
    req_goto_solar_system.set_lat(30.505);
    req_goto_solar_system.set_lon(114.431944);
    req_goto_solar_system.set_target_name("Moon");
    std::string serialized_data;
    req_goto_solar_system.SerializeToString(&serialized_data);
    testWsPacket(CMD_ASTRO_START_GOTO_SOLAR_SYSTEM, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*

*/
void testStopGoto() {
    log_i("testStopGoto");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_STOP_GOTO, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
*/
void testCaptureRawLiveStacking() {
    log_i("testCaptureRawLiveStacking");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_START_CAPTURE_RAW_LIVE_STACKING, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
0a 05 32 2e 30 2e 30 12 08 44 57 41 52 46 20 49 49 18 03 20 fc 55
*/
void testStopCaptureRawLiveStacking() {
    log_i("testStopCaptureRawLiveStacking");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_STOP_CAPTURE_RAW_LIVE_STACKING, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 03 20 ff 55
*/
void testCaptureDark() {
    log_i("testCaptureDark");
    ReqCaptureDarkFrame req_capture_dark;
    req_capture_dark.set_reshoot(0);
    std::string serialized_data;
    req_capture_dark.SerializeToString(&serialized_data);
    testWsPacket(CMD_ASTRO_START_CAPTURE_RAW_DARK, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*
12 08 44 57 41 52 46 20 49 49 18 03 20 80 56
*/
void testStopCaptureDark() {
    log_i("testStopCaptureDark");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_STOP_CAPTURE_RAW_DARK, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*

*/
void testCheckGotDark() {
    log_i("testCheckGotDark");
    std::string serialized_data;
    testWsPacket(CMD_ASTRO_CHECK_GOT_DARK, MODULE_ASTRO, CMD_TYPE_REQUEST, serialized_data);
}

/*---------------------------------------------通知模块-----------------------------------------------*/

void testResNotifySetParam(const std::string& client_id) {
    log_i("testResNotifiySetParam");
    // ResNotifyParam res_notify_set_param;
    // res_notify_set_param.set_hasauto(true);
    // res_notify_set_param.set_auto_mode(1);
    // res_notify_set_param.set_id(0);
    // res_notify_set_param.set_mode_index(0);

    // std::string serialized_data;
    // testWsPacketById(CMD_NOTIFY_TELE_SET_PARAM, MODULE_NOTIFY, CMD_TYPE_ACK, serialized_data, client_id);

}

/*----------------------------------------------全景模块----------------------------------------------*/
void testDataPanorama() {
    log_i("testDataPanorama");
    ReqStartPanoramaByGrid req_start_panorama_by_grid;
    
    req_start_panorama_by_grid.set_rows(5);
    req_start_panorama_by_grid.set_cols(5);

    std::string serialized_data;
    req_start_panorama_by_grid.SerializeToString(&serialized_data);
    testWsPacket(CMD_PANORAMA_START_GRID, MODULE_PANORAMA, CMD_TYPE_REQUEST, serialized_data);
}

void testDataAll() {
    //长焦摄像头模块
    testDataOpenCamTele();
    testDataCloseCamTele();
    testDataPhoto();
    // testDataBurstPhoto();
    // testDataStopBurstPhoto();
    // testDataStartRecord();
    // testDataStopRecord();
    testDataSetExpMode();
    testDataGetExpMode();
    testDataGetExp();
    testDataSetExp();
    // testDataSetExpById(WS_TEST_CLIENT_ID_1);
    // testDataSetExpById(WS_TEST_CLIENT_ID_2);
    // testDataSetGainMode();
    // testDataGetGainMode();
    // testDataSetGain();
    // testDataGetGain();
    // testDataSetBrightness();
    // testDataGetBrightness();
    // testDataSetContrast();
    // testDataGetContrast();
    // testDataSetSaturation();
    // testDataGetSaturation();
    // testDataSetHue();
    // testDataGetHue();
    // testDataSetSharpness();
    // testDataGetSharpness();
    // testDataSetWBMode();
    // testDataGetWBMode();
    // testDataSetWBScene();
    // testDataGetWBScene();
    // testDataSetWBCT();
    // testDataGetWBCT();
    // testDataSetIrCut();
    // testDataGetIrCut();
    // testDataStartTimeLapse();
    // testDataStopTimeLapse();
    // testDataGetAllParams();

    //广角摄像头模块
    testDataOpenCamWide();
    testDataCloseCamWide();
    testDataCamWidePhotograph();
    // testDataCamWideBurst();
    // testDataCamWideStopBurst();
    testDataCamWideSetExpMode();
    testDataCamWideGetExpMode();
    // testDataCamWideStartTimeLapse();
    // testDataCamWideStopTimeLapse();
    testDataCamWideSetExp();
    testDataCamWideGetExp();


    //系统模块
    // testDataSystemSetTime();
    // testDataSystemSetTimezone();

    //电机模块
    // testDataMotorRun();
    // testDataMotorStop();
    // testDataMotorChangeSpeed();
    // testDataMotorChangeDirection();
    // testDataMotorRunTo();
    // testDataMotorReset();
    // testDataMotorServiceJoystick();
    // testDataServiceJoystickFixedAngle();
    // testDataServiceJoystickStop();
    testDataDualCameraLinkage();

    //跟踪模块
    testDataStartTrack();
    testDataStopTrack();

    //天文模块
    testOneClickGoto();
    // testCalibration();
    // testStopCalibration();
    // testGotoNGC7000();
    // testGotoMoon();
    // testStopGoto();
    // testCaptureRawLiveStacking();
    // testStopCaptureRawLiveStacking();
    // testCaptureDark();
    // testStopCaptureDark();
    // testCheckGotDark();
    // 调焦模块
    // testDataAutoFocus();

    // 通知模块
    // testResNotifySetParam(WS_TEST_CLIENT_ID_1);
    // testResNotifySetParam(WS_TEST_CLIENT_ID_2);

    // 全景模块
    testDataPanorama();
}

